<template>
  <div class="box">
    <h2>Child component</h2>
    <p>来自于父组件的count: {{count}}</p>
    <button @click="increment(3)">更新父组件的数据</button>
  </div>
</template>

<script>
export default {
  name: 'Child',
  // 声明接收的props都会自动成为当前组件的属性
  props: {
    count: {
      type: Number,
      required: true
    },
    increment: Function,
  }
}
</script>

<style scoped>

</style>
